/*
* WavReader.h
*
*  Created on: Mar 21, 2013
*      Author: Centny
*/

#ifndef WAVREADER_H_
#define WAVREADER_H_
#include "AudioReaderBase.h"
namespace centny {
	namespace abl {

		class WavReader : AudioReaderBase {
		public:
			char ChunkID[4], Format[4], Subchunk1ID[4],Subchunk2ID[4];
			int ChunkSize,Subchunk1Size, SampleRate, ByteRate,Subchunk2Size;
			short AudioFormat, NumChannels, BlockAlign, BitsPerSample;
		private:
			FILE *fhandle;
		public:
			WavReader(const char* fpath);
			virtual int rate();
			virtual int bytesPerSample();
			virtual std::pair<AudioBlock*,AudioBlock*> read(bool derivative=false,int len=0);
			virtual ~WavReader();
		private:
			AudioBlock* readSingle(bool derivative=false,int len=0);
			std::pair<AudioBlock*,AudioBlock*> readTwo(bool derivative=false,int len=0);
		};

	} /* namespace abl */
} /* namespace centny */
#endif /* WAVREADER_H_ */
